// 将时间格式str转成毫秒时间戳
function parseStrToStamp(date) {
  var t = Date.parse(date);
  if (!isNaN(t)) {
      return Date.parse(date.replace(/-/g, "/"));
  } else {
      return new Date().getTime();
  }
}

// 设置查询毫秒时间戳范围参数
function setTimestampRangeParam() {
  var laydate = $('#laydate').val();
  if (isNotEmpty(laydate)) {
    var strArr = laydate.split('~');
    // 设置开始时间条件
    $('#createTimeB').val(parseStrToStamp(strArr[0].trim()));
    // 设置结束时间条件
    $('#createTimeE').val(parseStrToStamp(strArr[1].trim()));
  }
}

function getHeadTd(name) {
  return '<td class="head"><span>' + name + '</span></td>';
}

function getHead(headArray) {
  var tr = "<tr>";
  $.each(headArray, function(index, item) {
    tr += getHeadTd(item);
  });
  tr += "</tr>";
  return tr;
}

function getValueTd(value) {
  return '<td>' + value + '</td>';
}

function getValueTr(valueArray) {
  var tr = "<tr>";
  $.each(valueArray, function(index, item) {
    tr += getValueTd(item);
  });
  tr += "</tr>";
  return tr;
}
function filtUndef(value) {
  if (typeof (value) == "undefined") {
    return "";
  }
  return value;
}

function getYmdTime(value) {
  return getTimeYMDStr(value);
}



function convertLevel(params) {
  var level = params;
  var result = "";
  if (level == 1) {
    result = "文科";
  } else if (level == 2) {
    result = "理科";
  } else {
    result = "--";
  }
  return result;
}

function getBatch(batch) {
  if (batch == 1) {
    return "本科一批";
  } else if (batch == 2) {
    return "本科二批";
  } else if (batch == 3) {
    return "本科三批";
  } else {
    return "其它批次";
  }
}

function convertDirection(params) {
  var level = params;
  var result = "";
  if (level == 1) {
    result = "文科";
  } else if (level == 2) {
    result = "理科";
  } else {
    result = "--";
  }
  return result;
}

function getProvinceList() {
  var provinceData = [ "北京", "天津", "上海", "重庆", "河北", "山西", "内蒙古", "辽宁", "吉林",
      "黑龙江", "江苏", "浙江", "安徽", "福建", "江西", "山东", "河南", "湖北", "湖南", "广东", "广西",
      "海南", "四川", "贵州", "云南", "西藏", "陕西", "甘肃", "青海", "宁夏", "新疆", "香港", "澳门",
      "台湾" ];
  var option = "<option value='' selected='selected'>全部</option>";
  $.each(provinceData, function(index, item) {
    option += "<option value='" + item + "'>" + item + "</option>";
  });
  $("#provinceName").html(option);
}

function getState(state){
	//1:待联系 2:咨询中 3:完毕
	 if(state == 1){
		 return "待联系";
	 } else if(state == 2) {
		 return "咨询中";
	 }else if(state == 2) {
		 return "完毕";
	 } else {
		 return "--";
	 }
}